package per.jdz.socket.serialization;

import per.jdz.common.constants.RpcSerialization;
import per.jdz.spi.ExtensionLoader;

import java.io.IOException;

/**
 * @description:
 * @Author: Jdz
 * @CreateTime: 2024-03-08 11:57
 */
public class SerializationFactory {
    public static per.jdz.socket.serialization.RpcSerialization get(RpcSerialization serialization){
        return ExtensionLoader.getInstance().get(serialization.name);
    }

    public static per.jdz.socket.serialization.RpcSerialization get(String name){
        return ExtensionLoader.getInstance().get(name);
    }

    public static void init() throws IOException, ClassNotFoundException {
        ExtensionLoader.getInstance().loadExtension(per.jdz.socket.serialization.RpcSerialization.class);
    }
}
